package com.netease.pris.c;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import com.netease.b.a.d;
import com.netease.b.b.e.j;
import com.netease.pris.atom.b;
import com.netease.pris.protocol.c;
import com.netease.pris.provider.af;
import java.util.HashMap;
import java.util.Map;

public class l
{
  public static String[] a;
  public static final int b = 0;
  public static final int c = 1;
  public static final int d = 2;
  public static final int e = 3;
  public static final int f = 4;
  public static final int g = 5;
  public static final int h = 6;
  public static final int i = 7;
  public static final int j = 8;
  public static final int k = 9;

  static
  {
    String[] arrayOfString = new String[10];
    arrayOfString[0] = "_id";
    arrayOfString[1] = "account";
    arrayOfString[2] = "name";
    arrayOfString[3] = "last_login";
    arrayOfString[4] = "type_weibo";
    arrayOfString[5] = "token_weibo";
    arrayOfString[6] = "secret_weibo";
    arrayOfString[7] = "main_url";
    arrayOfString[8] = "portrait_url";
    arrayOfString[9] = "other";
    a = arrayOfString;
  }

  public static Cursor a(Context paramContext)
  {
    return a(paramContext, d.h().c());
  }

  public static Cursor a(Context paramContext, String paramString)
  {
    Cursor localCursor = null;
    if (paramContext == null);
    while (true)
    {
      return localCursor;
      if (paramString == null)
        paramString = d.h().c();
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = af.k;
      String[] arrayOfString1 = a;
      String[] arrayOfString2 = new String[1];
      arrayOfString2[0] = paramString;
      localCursor = localContentResolver.query(localUri, arrayOfString1, "account =?", arrayOfString2, null);
    }
  }

  private static void a(ContentValues paramContentValues, Cursor paramCursor, String paramString, int paramInt)
  {
    String str = paramCursor.getString(paramInt);
    if (str != null)
      paramContentValues.put(paramString, str);
  }

  public static void a(Context paramContext, int paramInt)
  {
    if (paramContext == null);
    while (true)
    {
      return;
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = af.k;
      String[] arrayOfString = new String[2];
      arrayOfString[0] = String.valueOf(paramInt);
      arrayOfString[1] = d.h().c();
      localContentResolver.delete(localUri, "type_weibo =?  AND account =? ", arrayOfString);
    }
  }

  public static void a(Context paramContext, String paramString1, int paramInt, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6)
  {
    a(paramContext, d.h().c(), paramString1, paramInt, paramString2, paramString3, paramString4, paramString5, paramString6);
  }

  public static void a(Context paramContext, String paramString1, String paramString2)
  {
    if ((TextUtils.isEmpty(paramString2)) || (paramContext == null));
    while (true)
    {
      return;
      if (paramString1 == null)
        paramString1 = d.h().c();
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = af.k;
      String[] arrayOfString = new String[2];
      arrayOfString[0] = paramString2;
      arrayOfString[1] = paramString1;
      localContentResolver.delete(localUri, "name =? AND account =?", arrayOfString);
    }
  }

  public static void a(Context paramContext, String paramString1, String paramString2, int paramInt, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7)
  {
    if ((paramContext == null) || (TextUtils.isEmpty(paramString2)));
    while (true)
    {
      return;
      if (paramString1 == null)
        paramString1 = d.h().c();
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = af.k;
      String[] arrayOfString1 = a;
      String[] arrayOfString2 = new String[3];
      arrayOfString2[0] = paramString2;
      arrayOfString2[1] = String.valueOf(paramInt);
      arrayOfString2[2] = paramString1;
      Cursor localCursor = localContentResolver.query(localUri, arrayOfString1, "name =?  AND type_weibo =? AND account =?", arrayOfString2, null);
      int m = 1;
      if ((localCursor == null) || (!localCursor.moveToFirst()))
        m = 0;
      if (localCursor != null)
        localCursor.close();
      if (m != 0)
      {
        ContentValues localContentValues1 = new ContentValues();
        localContentValues1.put("token_weibo", paramString3);
        localContentValues1.put("secret_weibo", paramString4);
        localContentValues1.put("main_url", paramString5);
        localContentValues1.put("portrait_url", paramString6);
        paramContext.getContentResolver().update(af.k, localContentValues1, "name =?  AND type_weibo =? AND account =?", null);
        continue;
      }
      ContentValues localContentValues2 = new ContentValues();
      localContentValues2.put("token_weibo", paramString3);
      localContentValues2.put("secret_weibo", paramString4);
      localContentValues2.put("account", paramString1);
      localContentValues2.put("name", paramString2);
      localContentValues2.put("type_weibo", Integer.valueOf(paramInt));
      localContentValues2.put("main_url", paramString5);
      localContentValues2.put("portrait_url", paramString6);
      paramContext.getContentResolver().insert(af.k, localContentValues2);
    }
  }

  // ERROR //
  public static boolean a(Context paramContext, String paramString, int paramInt)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_3
    //   2: iconst_1
    //   3: istore 4
    //   5: aload_1
    //   6: ifnonnull +10 -> 16
    //   9: invokestatic 62	com/netease/b/a/d:h	()Lcom/netease/b/a/d;
    //   12: invokevirtual 65	com/netease/b/a/d:c	()Ljava/lang/String;
    //   15: astore_1
    //   16: aload_0
    //   17: ifnonnull +16 -> 33
    //   20: iconst_0
    //   21: ifeq +9 -> 30
    //   24: aconst_null
    //   25: invokeinterface 132 1 0
    //   30: iload 4
    //   32: ireturn
    //   33: aload_0
    //   34: invokevirtual 74	android/content/Context:getContentResolver	()Landroid/content/ContentResolver;
    //   37: astore 9
    //   39: getstatic 79	com/netease/pris/provider/af:k	Landroid/net/Uri;
    //   42: astore 10
    //   44: getstatic 53	com/netease/pris/c/l:a	[Ljava/lang/String;
    //   47: astore 11
    //   49: iconst_2
    //   50: anewarray 31	java/lang/String
    //   53: astore 12
    //   55: aload 12
    //   57: iconst_0
    //   58: iload_2
    //   59: invokestatic 104	java/lang/String:valueOf	(I)Ljava/lang/String;
    //   62: aastore
    //   63: aload 12
    //   65: iconst_1
    //   66: aload_1
    //   67: aastore
    //   68: aload 9
    //   70: aload 10
    //   72: aload 11
    //   74: ldc 154
    //   76: aload 12
    //   78: aconst_null
    //   79: invokevirtual 87	android/content/ContentResolver:query	(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
    //   82: astore 13
    //   84: aload 13
    //   86: astore 7
    //   88: aload 7
    //   90: ifnull +17 -> 107
    //   93: aload 7
    //   95: invokeinterface 129 1 0
    //   100: istore 14
    //   102: iload 14
    //   104: ifne +89 -> 193
    //   107: iconst_0
    //   108: istore 8
    //   110: aload 7
    //   112: ifnull +10 -> 122
    //   115: aload 7
    //   117: invokeinterface 132 1 0
    //   122: iload 8
    //   124: istore 4
    //   126: goto -96 -> 30
    //   129: astore 6
    //   131: aconst_null
    //   132: astore 7
    //   134: aload 6
    //   136: invokevirtual 157	java/lang/NullPointerException:printStackTrace	()V
    //   139: aload 7
    //   141: ifnull +45 -> 186
    //   144: aload 7
    //   146: invokeinterface 132 1 0
    //   151: iload 4
    //   153: istore 8
    //   155: goto -33 -> 122
    //   158: astore 5
    //   160: aload_3
    //   161: ifnull +9 -> 170
    //   164: aload_3
    //   165: invokeinterface 132 1 0
    //   170: aload 5
    //   172: athrow
    //   173: astore 5
    //   175: aload 7
    //   177: astore_3
    //   178: goto -18 -> 160
    //   181: astore 6
    //   183: goto -49 -> 134
    //   186: iload 4
    //   188: istore 8
    //   190: goto -68 -> 122
    //   193: iload 4
    //   195: istore 8
    //   197: goto -87 -> 110
    //
    // Exception table:
    //   from	to	target	type
    //   33	84	129	java/lang/NullPointerException
    //   33	84	158	finally
    //   93	102	173	finally
    //   134	139	173	finally
    //   93	102	181	java/lang/NullPointerException
  }

  public static boolean a(Context paramContext, String paramString, b paramb)
  {
    int m = 1;
    switch (f.a[paramb.ordinal()])
    {
    default:
    case 1:
    case 2:
    }
    while (true)
    {
      return m;
      m = a(paramContext, paramString, 3);
      continue;
      boolean bool = a(paramContext, paramString, m);
    }
  }

  public static String[] a(Context paramContext, String paramString1, String paramString2, int paramInt)
  {
    String[] arrayOfString1 = null;
    if ((paramContext == null) || (TextUtils.isEmpty(paramString2)));
    while (true)
    {
      return arrayOfString1;
      if (paramString1 == null)
        paramString1 = d.h().c();
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = af.k;
      String[] arrayOfString2 = a;
      String[] arrayOfString3 = new String[3];
      arrayOfString3[0] = paramString2;
      arrayOfString3[1] = String.valueOf(paramInt);
      arrayOfString3[2] = paramString1;
      Cursor localCursor = localContentResolver.query(localUri, arrayOfString2, "name =?  AND type_weibo =?  AND account =?", arrayOfString3, null);
      arrayOfString1 = new String[2];
      if ((localCursor != null) && (localCursor.moveToFirst()))
      {
        arrayOfString1[0] = localCursor.getString(5);
        arrayOfString1[1] = localCursor.getString(6);
      }
      if (localCursor == null)
        continue;
      localCursor.close();
    }
  }

  public static j b(Context paramContext, String paramString, int paramInt)
  {
    j localj = null;
    if (paramString == null)
      paramString = d.h().c();
    ContentResolver localContentResolver = paramContext.getContentResolver();
    Uri localUri = af.k;
    String[] arrayOfString1 = a;
    String[] arrayOfString2 = new String[2];
    arrayOfString2[0] = String.valueOf(paramInt);
    arrayOfString2[1] = paramString;
    Cursor localCursor = localContentResolver.query(localUri, arrayOfString1, "type_weibo =? AND account =?", arrayOfString2, null);
    if (localCursor != null);
    try
    {
      if (localCursor.moveToFirst())
      {
        localj = new j(paramInt);
        localj.d(localCursor.getString(2));
        localj.b(localCursor.getString(5));
        localj.c(localCursor.getString(6));
      }
      do
        return localj;
      while (localCursor == null);
      localCursor.close();
    }
    finally
    {
      if (localCursor != null)
        localCursor.close();
    }
  }

  public static Map b(Context paramContext)
  {
    return b(paramContext, d.h().c());
  }

  public static Map b(Context paramContext, String paramString)
  {
    Object localObject = null;
    if (paramContext == null);
    while (true)
    {
      return localObject;
      if (paramString == null)
        paramString = d.h().c();
      HashMap localHashMap = new HashMap();
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = af.k;
      String[] arrayOfString1 = a;
      String[] arrayOfString2 = new String[1];
      arrayOfString2[0] = paramString;
      Cursor localCursor = localContentResolver.query(localUri, arrayOfString1, "account =?", arrayOfString2, null);
      if ((localCursor != null) && (localCursor.moveToFirst()))
        do
          localHashMap.put(localCursor.getString(1), localCursor.getString(0));
        while (localCursor.moveToNext());
      if (localCursor != null)
        localCursor.close();
      localObject = localHashMap;
    }
  }

  public static void b(Context paramContext, String paramString1, String paramString2, int paramInt)
  {
    if ((TextUtils.isEmpty(paramString2)) || (paramContext == null));
    while (true)
    {
      return;
      if ((paramInt == 3) || (paramInt == 2) || (paramInt == 1))
      {
        if (paramString1 == null)
          paramString1 = d.h().c();
        String str = "name = '" + paramString2 + "' AND " + "account" + " =?";
        ContentValues localContentValues = new ContentValues();
        localContentValues.put("type_weibo", Integer.valueOf(paramInt));
        ContentResolver localContentResolver = paramContext.getContentResolver();
        Uri localUri = af.k;
        String[] arrayOfString = new String[1];
        arrayOfString[0] = paramString1;
        localContentResolver.update(localUri, localContentValues, str, arrayOfString);
        continue;
      }
    }
  }

  public static int c(Context paramContext)
  {
    return c(paramContext, d.h().c());
  }

  public static int c(Context paramContext, String paramString)
  {
    int m = 0;
    if (paramContext == null)
      return m;
    if (paramString == null)
      paramString = d.h().c();
    ContentResolver localContentResolver = paramContext.getContentResolver();
    Uri localUri = af.k;
    String[] arrayOfString1 = a;
    String[] arrayOfString2 = new String[1];
    arrayOfString2[m] = paramString;
    Cursor localCursor = localContentResolver.query(localUri, arrayOfString1, "account =? ", arrayOfString2, null);
    int n;
    if (localCursor != null)
    {
      n = localCursor.getCount();
      localCursor.close();
    }
    while (true)
    {
      m = n;
      break;
      n = 0;
    }
  }

  public static String[] c(Context paramContext, String paramString, int paramInt)
  {
    return a(paramContext, d.h().c(), paramString, paramInt);
  }

  public static void d(Context paramContext, String paramString)
  {
    a(paramContext, d.h().c(), paramString);
  }

  public static void e(Context paramContext, String paramString)
  {
    if ((paramContext != null) && (paramString != null) && (!paramString.equals(c.b)))
    {
      ContentResolver localContentResolver1 = paramContext.getContentResolver();
      Uri localUri1 = af.k;
      String[] arrayOfString1 = a;
      String[] arrayOfString2 = new String[1];
      arrayOfString2[0] = c.b;
      Cursor localCursor = localContentResolver1.query(localUri1, arrayOfString1, "account =? ", arrayOfString2, null);
      if (localCursor != null)
      {
        if (localCursor.moveToFirst())
        {
          ContentResolver localContentResolver2 = paramContext.getContentResolver();
          Uri localUri2 = af.k;
          String[] arrayOfString3 = new String[1];
          arrayOfString3[0] = paramString;
          localContentResolver2.delete(localUri2, "account =? ", arrayOfString3);
          do
          {
            ContentValues localContentValues = new ContentValues();
            a(localContentValues, localCursor, "name", 2);
            localContentValues.put("last_login", Long.valueOf(localCursor.getLong(3)));
            localContentValues.put("type_weibo", Integer.valueOf(localCursor.getInt(4)));
            a(localContentValues, localCursor, "token_weibo", 5);
            a(localContentValues, localCursor, "secret_weibo", 6);
            a(localContentValues, localCursor, "main_url", 7);
            a(localContentValues, localCursor, "portrait_url", 8);
            a(localContentValues, localCursor, "other", 9);
            localContentValues.put("account", paramString);
            paramContext.getContentResolver().insert(af.k, localContentValues);
          }
          while (localCursor.moveToNext());
        }
        localCursor.close();
      }
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.c.l
 * JD-Core Version:    0.6.0
 */